package com.hk.button;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.hk.global.Constance;
import com.hk.global.ImageUrl;

public class ButtonBatting extends SuperButton {
	private int x = 30;
	private int y = 180;
	private int w = 130;
	private int h = 40;

	public ButtonBatting() {
		BoundsButton(x, y, w, h);
		SetButtonIcon(ImageUrl.B_BATTING);
	}

	@Override
	protected void ActionButton() {
		button.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (!pg.isPlay() && !pg.isEnd()) {
					int temp = pg.getBatting()+ Constance.BATTING;
					if (pg.getMoney()-temp>=0) {
						pg.setBatting(temp);
					}
				}
				ngLab.updateLabel();
			}
		});
	}
	@Override
	public void HideButton() {
		BoundsButton(x, y, w, h);
	}
	@Override
	public void ShowButton() {
		BoundsButton(0, 0, 0, 0);
	}
	@Override
	public JButton getButton() {
		return button;
	}
}
